﻿using System;
using Itdavany.Objects;
using Itdavany.Utility;
using Itdavany.Data;
using RollingKitty.Data;
//using RollingKitty.Data.Design;
using RollingKitty.Data.Format;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace RollingKitty.Objects
{
    class NameDisplay : Widget
    {
        //NameDisplaySkin nds;
        string name;
        string title;

        XNAExtras.BitmapFont namefont;
        Color namecolor;
        XNAExtras.BitmapFont titlefont;
        Color titlecolor;

        /*public NameDisplay(NameDisplaySkin nds)
        {
            this.nds = nds;

            this.namefont = SharedFont.Load(nds.name_fontname);
            this.titlefont = SharedFont.Load(nds.title_fontname);
            this.namecolor = nds.name_fontcolor;
            this.titlecolor = nds.title_fontcolor; 
        }*/

        public string Name
        {
            get
            {
                return name;
            }

            set
            {
                name = value;               
            }
        }

        public string Title
        {
            get
            {
                return title;
            }

            set
            {
                title = value;
            }
        }

        public override void Draw()
        {
            DefaultSpriteBatch.Begin();

            namefont.SpriteBatchOverride(DefaultSpriteBatch);
            titlefont.SpriteBatchOverride(DefaultSpriteBatch);

            namefont.DrawString(X + nds.namex - namefont.MeasureString(name) / 2, Y + nds.namey - namefont.LineHeight / 2,
                namecolor, name);

            titlefont.DrawString(X + nds.titlex - titlefont.MeasureString(title) / 2, Y + nds.titley - titlefont.LineHeight / 2,
                titlecolor, title);

            namefont.SpriteBatchOverride(null);
            titlefont.SpriteBatchOverride(null);

            DefaultSpriteBatch.End();

            base.Draw();
        }
    }
}
